package com.casstime.ec.cloud.service.giftPromotion;

import java.util.Date;
import java.util.List;

import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import com.casstime.ec.cloud.spi.PagedModels;
import com.casstime.ec.cloud.values.amountPromotion.AmountPromotionCompany;
import com.casstime.ec.cloud.values.amountPromotion.AmountPromotionQueryRequest;
import com.casstime.ec.cloud.values.giftPromotion.GiftDeduction;
import com.casstime.ec.cloud.values.giftPromotion.GiftDeductionGift;
import com.casstime.ec.cloud.values.giftPromotion.GiftProduct;
import com.casstime.ec.cloud.values.giftPromotion.GiftProductAudit;
import com.casstime.ec.cloud.values.giftPromotion.GiftProductUpdateRecord;
import com.casstime.ec.cloud.values.giftPromotion.GiftPromotion;
import com.casstime.ec.cloud.values.giftPromotion.GiftPromotionFlowing;
import com.casstime.ec.cloud.values.giftPromotion.GiftPromotionFlowingRequest;
import com.casstime.ec.cloud.values.giftPromotion.GiftPromotionGiftVO;
import com.casstime.ec.cloud.values.giftPromotion.GiftPromotionProduct;
import com.casstime.ec.cloud.values.giftPromotion.GiftPromotionRequest;
import com.casstime.ec.cloud.values.giftPromotion.GiftPromotionUpdateRecord;
import com.casstime.ec.cloud.values.giftPromotion.GiftRequest;

/**
 * ClassName: DiscountService 
 * Function: (买赠促销)
 * Reason: ADD REASON(可选).
 *  
 * @author wu.chen 
 * 2018年2月26日 上午10:59:31
 * @version   
 * @since JDK 1.8
 */
@FeignClient("discount-service")
public interface GiftPromotionService {

	/**
	 * --------------------------------------------------------------------------------
	 * 
	 * 赠品相关接口.
	 * 
	 * --------------------------------------------------------------------------------
	 */
	/**
	 * addOrUpdateGiftProduct:(赠品新增修改).<br/>
	 * @author wu.chen
	 * @date 2018年3月9日 下午2:31:31
	 */
	@RequestMapping(value = "/discount/giftProduct/addOrUpdate", method = RequestMethod.POST)
	int addOrUpdateGiftProduct(@RequestBody GiftProduct giftProduct,
			@RequestParam("userLoginId") String userLoginId,
			@RequestParam("companyId") String companyId) throws Exception;
	
	/**
	 * listGiftProducts:(赠品多条件分页查询接口).<br/>
	 * @author wu.chen
	 * @date 2018年3月9日 下午2:31:31
	 */
	@RequestMapping(value = "/discount/giftProduct/list", method = RequestMethod.POST)
	PagedModels<GiftProduct> listGiftProducts(@RequestBody GiftRequest giftReq,
			@RequestParam("pageSize") Integer pageSize,
			@RequestParam("pageNum") Integer pageNum) throws Exception;

	/**
	 * shelvesGiftProduct:(赠品上下架接口).<br/>
	 * @author wu.chen
	 * @date 2018年3月9日 下午2:31:31
	 */
	@RequestMapping(value = "/discount/giftProduct/updateOnsaleStatus", method = RequestMethod.POST)
	int shelvesGiftProduct(@RequestBody List<String> giftIds,
			@RequestParam("onsaleStatus") String onsaleStatus,
			@RequestParam("userLoginId") String userLoginId,
			@RequestParam("companyId") String companyId) throws Exception;
	
	/**
	 * validGiftProduct:(赠品上下架校验接口).<br/>  
	 * @author 徐彪
	 * @date 2018年3月30日 下午7:59:45
	 */
	@RequestMapping(value = "/discount/giftProduct/validOnsaleStatus", method = RequestMethod.POST)
	List<String> validGiftProduct(@RequestBody List<String> giftIds,
			@RequestParam("onsaleStatus") String onsaleStatus,
			@RequestParam("userLoginId") String userLoginId,
			@RequestParam("companyId") String companyId) throws Exception;
	
	/**
	 * findGiftProductByIds:(根据赠品ID查询赠品信息).<br/>
	 * @author wu.chen
	 * @date 2018年3月9日 下午2:31:31
	 */
	@RequestMapping(value = "/discount/giftProduct/findByIds", method = RequestMethod.POST)
	List<GiftProduct> findGiftProductByIds(@RequestBody List<String> giftIds) throws Exception;
	
	/**
	 * auditGiftProductByIds:(审核赠品).<br/>  
	 * @param giftIds 赠品ID  
	 * @param auditStatus 审核状态
	 * @param auditReason 
	 * @param userLoginId 
	 * @return
	 * @throws Exception
	 * @author 徐彪
	 * @date 2018年3月20日 上午11:05:20
	 */
	@RequestMapping(value = "/discount/giftProduct/updateAuditStatus", method = RequestMethod.POST)
	int auditGiftProductByIds(@RequestBody List<String> giftIds, 
			@RequestParam("auditStatus") String auditStatus,
			@RequestParam("auditReason") String auditReason,
			@RequestParam("userLoginId") String userLoginId) throws Exception;
	
	/**
	 * findGiftProductUpdateRecordById:(根据赠品Id和类型查询赠品信息).<br/>   
	 * @param giftId
	 * @param typeId
	 * @return
	 * @throws Exception
	 * @author 徐彪
	 * @date 2018年3月20日 下午3:33:23
	 */
	@RequestMapping(value = "/discount/giftProductAudit/findById", method = RequestMethod.GET)
	List<GiftProductUpdateRecord> findGiftProductUpdateRecordById(@RequestParam("giftId") String giftId, 
			@RequestParam("typeId") String typeId) throws Exception;
	
	/**
	 * findGiftProductAuditByIds:(根据赠品ID查找赠品处理类).<br/>  
	 * @param giftIds
	 * @return
	 * @throws Exception
	 * @author 徐彪
	 * @date 2018年3月21日 上午11:42:38
	 */
	@RequestMapping(value = "/discount/giftProductAudit/findByGiftIds", method = RequestMethod.POST)
	List<GiftProductAudit> findGiftProductAuditByGiftIds(@RequestBody List<String> giftIds) throws Exception;
	
	/**
	 * findGiftProductByProductIds:(根据商品ID查询赠品列表).<br/>  
	 * @param productIds
	 * @return
	 * @throws Exception
	 * @author 徐彪
	 * @date 2018年3月23日 下午1:58:41
	 */
	@RequestMapping(value = "/discount/giftProduct/findByPoductIds", method = RequestMethod.POST)
	List<GiftPromotionGiftVO> findGiftProductByProductIds(@RequestBody AmountPromotionQueryRequest queryRequest) throws Exception;
	/**
	 * --------------------------------------------------------------------------------
	 * 
	 * 买赠活动相关接口.
	 * 
	 * --------------------------------------------------------------------------------
	 */
	
	/**
	 * addOrUpdateGiftPromotion:(修改新增买赠活动接口).<br/>
	 * @author wu.chen
	 * @date 2018年3月9日 下午2:34:46
	 */
	@RequestMapping(value = "/discount/giftPromotion/addOrUpdate", method = RequestMethod.POST)
	int addOrUpdateGiftPromotion(@RequestBody GiftPromotion giftPromotion,
			@RequestParam("userLoginId") String userLoginId,
			@RequestParam("companyId") String companyId) throws Exception;
	
	/**
	 * stopGiftPromotion:(修改新增买赠活动接口).<br/>
	 * @author wu.chen
	 * @date 2018年3月9日 下午2:34:46
	 */
	@RequestMapping(value = "/discount/giftPromotion/{promotionId}/stop", method = RequestMethod.GET)
	int stopGiftPromotion(@PathVariable("promotionId") String promotionId,
			@RequestParam("userLoginId") String userLoginId) throws Exception;

	/**
	 * findGiftPromotion:(买赠活动根据Id查询接口).<br/>
	 * @author wu.chen
	 * @date 2018年3月9日 下午2:34:46
	 */
	@RequestMapping(value = "/discount/giftPromotion/{promotionId}/find", method = RequestMethod.GET)
	GiftPromotion findGiftPromotion(@PathVariable("promotionId") String promotionId) throws Exception;
	
	
	@RequestMapping(value = "/discount/giftPromotion/{promotionId}/findProducts", method = RequestMethod.GET)
	PagedModels<GiftPromotionProduct> listGiftPromotionProductsById(@PathVariable("promotionId") String promotionId,
			@RequestParam("pageSize") Integer pageSize, @RequestParam("pageNum") Integer pageNum) throws Exception;

	/**
	 * listGiftPromotionRecordById:(买赠活动修改记录查询接口).<br/>
	 * @author wu.chen
	 * @date 2018年3月9日 下午2:34:46
	 */
	@RequestMapping(value = "/discount/giftPromotion/updateRecord/{promotionId}", method = RequestMethod.GET)
	PagedModels<GiftPromotionUpdateRecord> listGiftPromotionRecordById(@PathVariable("promotionId") String promotionId,
														   @RequestParam("pageSize") Integer pageSize,
														   @RequestParam("pageNum") Integer pageNum) throws Exception;
	
	/**
	 * listGiftPromotionStoreId:(买赠活动多条件分页查询接口).<br/>
	 * @author wu.chen
	 * @date 2018年3月9日 下午2:34:46
	 */
	@RequestMapping(value = "/discount/giftPromotion/{productStoreId}/list", method = RequestMethod.POST)
	PagedModels<GiftPromotion> listGiftPromotionStoreId(@PathVariable("productStoreId") String productStoreId,
														   @RequestParam("pageSize") Integer pageSize,
														   @RequestParam("pageNum") Integer pageNum,
														   @RequestBody GiftPromotionRequest request) throws Exception;
	
	/**
	 * validGiftPromotionProduct:(买赠商品校验接口).<br/>
	 * @author wu.chen
	 * @date 2018年3月9日 下午2:34:46
	 */
	@RequestMapping(value = "/discount/giftPromotion/{productStoreId}/validProduct", method = RequestMethod.POST)
	List<String> validGiftPromotionProducts(@PathVariable("productStoreId") String productStoreId,
			@RequestParam(name = "giftPromotionId", required = false) String giftPromotionId,
			@RequestParam("startDate") Date startDate,
			@RequestParam("endDate") Date endDate,
			@RequestBody List<String> productIds) throws Exception;
	
	/**
	 * 
	 * listGiftPromotionFlowStoreId:(买赠活动流水).<br/>  
	 * @param productStoreId
	 * @param pageSize
	 * @param pageNum
	 * @param request
	 * @return
	 * @throws Exception
	 * @author hongcheng.wu
	 * @date 2018年4月4日 下午2:44:44
	 */
	@RequestMapping(value = "/discount/giftFlowing/{productStoreId}/list", method = RequestMethod.POST)
	PagedModels<GiftPromotionFlowing> listGiftPromotionFlowStoreId(@PathVariable("productStoreId") String productStoreId,
														   @RequestParam("pageSize") Integer pageSize,
														   @RequestParam("pageNum") Integer pageNum,
														   @RequestBody GiftPromotionFlowingRequest request) throws Exception;
	
	@RequestMapping(value = "/discount/listGiftPromotionCompany/{productStoreId}/list", method = RequestMethod.GET)
	List<AmountPromotionCompany> listGiftPromotionCompany(@PathVariable("productStoreId") String productStoreId) throws Exception;
	
	/**
	 * 
	 * giftDeductionForOrder:(订单下单扣减赠品).<br/>   
	 * @param request
	 * @return
	 * @throws Exception
	 * @author hongcheng.wu
	 * @date 2018年4月3日 下午4:39:21
	 */
	@RequestMapping(value = "/discount/giftPromotion/giftDedution", method = RequestMethod.POST)
	GiftDeduction giftDeductionForOrder(@RequestBody GiftDeduction request) throws Exception;
	
	/**
	 * 
	 * giftFallbackForOrder:(取消订单赠品回退).<br/>    
	 * @param gifts
	 * @throws Exception
	 * @author hongcheng.wu
	 * @date 2018年4月3日 下午4:43:22
	 */
	@RequestMapping(value = "/discount/giftPromotion/giftFallback", method = RequestMethod.POST)
	void giftFallbackForOrder(@RequestBody List<GiftDeductionGift> gifts)throws Exception;
	
	

}
